
package sintatico;

import exceptions.ParserException;
import lexico.ErrorTable;
import lexico.SymbolTable;
import productions.*;


/**
 * @author Ronaldo
 */

/**
 * Inicia a execução do parser
 */
public class Parser {

    private AbstractProductionRule pr;
    private SymbolTable st;
    private ErrorTable et;
//    private ErrorTableParser etp;

    /**
     *
     * recebe a tabela de simbolos e a tabela de erros.
     * Cada tabela será enviada para cada uma das produções;
     */
    public Parser(SymbolTable st, ErrorTable et){
        this.et = et;
        this.st = st;
    }

    public void scan() throws ParserException {
       StartProduction.getInstance().analyze(st, et);
    }

    public ErrorTable getErrorTable() {
        return et;
    }

	/**
	 * Ow coisinha feia viu!
         * there, I fixed it.
	 */
//	public void setTables(){
//		AlgoritmoProduction.getInstance().setTables(st, etp);
//		TipoPrimitivoProduction.getInstance().setTables(st, etp);
//		TipoVariavelProduction.getInstance().setTables(st, etp);
//		LeiaProduction.getInstance().setTables(st, etp);
//		OpSomaProduction.getInstance().setTables(st, etp);
//		OpMultProduction.getInstance().setTables(st, etp);
//		OpRelacionalProduction.getInstance().setTables(st, etp);
//		OpIncProduction.getInstance().setTables(st, etp);
//		CastProduction.getInstance().setTables(st, etp);
//		ConstanteProduction.getInstance().setTables(st, etp);
//		TipoDefinidoProduction.getInstance().setTables(st, etp);
//		RegistroProduction.getInstance().setTables(st, etp);
//		PrincipalProduction.getInstance().setTables(st, etp);
//		BlocoProduction.getInstance().setTables(st, etp);
//		ExprProduction.getInstance().setTables(st, etp);
//		SeProduction.getInstance().setTables(st, etp);
//		EnquantoProduction.getInstance().setTables(st, etp);
//		ValorProduction.getInstance().setTables(st, etp);
//		TipoRetornoFProduction.getInstance().setTables(st, etp);
//		ParamsProduction.getInstance().setTables(st, etp);
//		ChamadaFuncaoProduction.getInstance().setTables(st, etp);
//		EscrevaProduction.getInstance().setTables(st, etp);
//		RetornoProduction.getInstance().setTables(st, etp);
//		InitArrayProduction.getInstance().setTables(st, etp);
//		InitsProduction.getInstance().setTables(st, etp);
//		ArrayProduction.getInstance().setTables(st, etp);
//		ExprAritProduction.getInstance().setTables(st, etp);
//		ArrayDProduction.getInstance().setTables(st, etp);
//		DclrPrimitivoProduction.getInstance().setTables(st, etp);
//		DclrVarProduction.getInstance().setTables(st, etp);
//		ArgsProduction.getInstance().setTables(st, etp);
//		FuncaoProduction.getInstance().setTables(st, etp);
//		DclrVarInitProduction.getInstance().setTables(st, etp);
//		VariaveisProduction.getInstance().setTables(st, etp);
//		DeclarationsProduction.getInstance().setTables(st, etp);
//		StartProduction.getInstance().setTables(st, etp);
//		ComandosProduction.getInstance().setTables(st, etp);
//		ParaProduction.getInstance().setTables(st, etp);
//		InstrucaoProduction.getInstance().setTables(st, etp);
//		SentencaProduction.getInstance().setTables(st, etp);
//		FatorProduction.getInstance().setTables(st, etp);
//		TermoProduction.getInstance().setTables(st, etp);
//		ExprRelProduction.getInstance().setTables(st, etp);
//		ExprAndProduction.getInstance().setTables(st, etp);
//	}

}
